<template>
    <view class="content">
        <u-cell-group>
            <u-cell title="客户名称" :value="detail.business.nickname"></u-cell>
			<u-cell title="联系方式" :value="detail.business.mobile"></u-cell>
            <u-cell title="性别" v-if="detail.gender == 0" value="保密"></u-cell>
            <u-cell title="性别" v-else-if="detail.business.gender == 1" value="男"></u-cell>
            <u-cell title="性别" v-else-if="detail.business.gender == 2" value="女"></u-cell>
            <u-cell title="客户来源" :value="detail.business.source_text"></u-cell>
			<u-cell title="订单内容">
				<view slot="value" class="u-slot-title">
					<text>课程名称：{{detail.subject.title}}</text>
					<u--image :showLoading="true" :src="detail.subject.thumbs_text" width="150px" height="80px" @click="click"></u--image>
				</view>
			</u-cell>
            <u-cell title="订单总额" :value="detail.total"></u-cell>
            <u-cell title="下单时间" :value="detail.createtime_text"></u-cell>
            <u-cell title="地区" :value="detail.business.region_text"></u-cell>
        </u-cell-group>
        
        <u-toast ref="uToast"></u-toast>
    </view>
</template>

<script>
export default {
    data() {
        return {
			LoginUser:{},
            id: 0,
            detail: {
                source: {
                    name: ''
                }
            },
            RegionShow: false
        }
    },
    onLoad(options)
    {
		this.LoginUser = uni.getStorageSync('LoginUser') ? uni.getStorageSync('LoginUser') : {}
		
        this.id = options.orderid ? options.orderid : 0

        this.getInfoData()
    },
    methods: {
        async getInfoData()
        {
			let data={
				orderid:this.id,
				Adminid:this.LoginUser.id
			}
            let result = await this.$u.api.order.getSubinfo(data)

            if(result.code === 0)
            {
                this.$refs.uToast.show({
                    type:'error',
                    message:result.msg,
                    complete:() => {
                        this.$u.route({
                            type:'redirectTo',
                            url:'/packageC/suborder/index'
                        })
                    }
                })

                return false
            }else{
                this.detail = result.data
            }
        }
    },
}
</script>